import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    data: data
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
//邀请记录
export function getInviteRecord(userId,pageNum) {
  return request({
    url: '/user/inviteRecord?userId='+userId+'&pageNum='+pageNum,
    method: 'get',
  })
}
//趣能卡列表
export function getQuFunCardList(userId,pageNum) {
  return request({
    url: '/jh/card/cardList?userId='+userId+'&pageNum='+pageNum,
    method: 'get',
  })
}

//转赠趣能卡
export function cardpresent(data) {
  return request({
    url: '/jh/card/present',
    method: 'get',
	data:data
  })
}

//升级趣能卡
export function cardUpgrade(data) {
  return request({
    url: '/jh/card/upgrade',
    method: 'get',
	data:data
  })
}

//趣能卡详情
export function getCardDtails(id) {
  return request({
    url: '/jh/card/detail/'+id,
    method: 'get',
  })
}
//趣能卡升级消耗
export function getUpgradeJh(data) {
  return request({
    url: '/jh/jhConfig/getUpgradeJh',
    method: 'get',
	data:data
  })
}
//趣能卡升级消耗
export function presentJh(data) {
  return request({
    url: '/jh/record/present',
    method: 'get',
	data:data
  })
}